package com.eatables.util;

public class QueryConstants {

   public static final String GET_ALL_DETAILS   = "SELECT ml.slno , " 
                                                         + " ml.rname,"
                                                         + "  ml.lat, " 
                                                         + "ml.lng, " 
                                                         //+ "ml.forumid, " 
                                                         + "ml.typeof "
                                                         + "FROM tbl_master_list ml";
                                                         		//", tbl_rating r  "
                                                         //+ "WHERE ml.slno=r.slno";
   public static final String GET_ALL_DETAILS_CHN   = "SELECT ml.slno , " 
												       + " ml.rname,"
												       + "  ml.lat, " 
												       + "ml.lng, " 
												       + "ml.typeof "
												       + "FROM tbl_master_list_chennai ml";
   
   public static final String GET_ALL_DETAILS_KOL   = "SELECT ml.slno , " 
												       + " ml.rname,"
												       + "  ml.lat, " 
												       + "ml.lng, " 
												       + "ml.typeof "
												       + "FROM tbl_master_list_kolkata ml";
   
   public static final String GET_ALL_DETAILS_BEN   = "SELECT ml.slno , " 
												       + " ml.rname,"
												       + "  ml.lat, " 
												       + "ml.lng, " 
												       + "ml.typeof "
												       + "FROM tbl_master_list_bengaluru ml";

   public static final String GET_HOTEL_DETAILS = "SELECT ml.slno, " 
                                                         + "replace(ml.rname,'&','&amp;') as 'name', "
                                                         + "replace(ml.descr,'&','&amp;') as 'desc',"
                                                         + "ifnull(ml.addr,'<a href=javascript:addressHelp()>Help me find Address !</a>') as 'address', "
                                                         + "ml.lat, " + "ml.lng, "
                                                         + "ifnull(ml.telno1,'<a href=javascript:telephoneHelp()>Help me find Tel.No.!</a>'), "
                                                         + "ifnull(ml.telno2,'N/A'), " + "ml.forumid , " + "ml.typeof "
                                                         + "FROM tbl_master_list ml "
                                                         + "WHERE ml.slno=";
   
   public static final String GET_HOTEL_DETAILS_CHN = "SELECT ml.slno, " 
													       + "replace(ml.rname,'&','&amp;') as 'name', "
													       + "replace(ml.descr,'&','&amp;') as 'desc',"
													       + "ifnull(ml.addr,'Help me find Address !') as 'address', "
													       + "ml.lat, " + "ml.lng, "
													       + "ifnull(ml.telno1,'Help me find Tel.No.!'), "
													       + "ifnull(ml.telno2,'N/A'), " + "ml.typeof "
													       + "FROM tbl_master_list_chennai ml " 
													       + "WHERE ml.slno=";
   public static final String GET_HOTEL_DETAILS_KOL = "SELECT ml.slno, " 
													       + "replace(ml.rname,'&','&amp;') as 'name', "
													       + "replace(ml.descr,'&','&amp;') as 'desc',"
													       + "ifnull(ml.addr,'Help me find Address !') as 'address', "
													       + "ml.lat, " + "ml.lng, "
													       + "ifnull(ml.telno1,'Help me find Tel.No.!'), "
													       + "ifnull(ml.telno2,'N/A'), " + "ml.typeof "
													       + "FROM tbl_master_list_kolkata ml " 
													       + "WHERE ml.slno=";
   
   public static final String GET_HOTEL_DETAILS_BEN = "SELECT ml.slno, " 
													       + "replace(ml.rname,'&','&amp;') as 'name', "
													       + "replace(ml.descr,'&','&amp;') as 'desc',"
													       + "ifnull(ml.addr,'Help me find Address !') as 'address', "
													       + "ml.lat, " + "ml.lng, "
													       + "ifnull(ml.telno1,'Help me find Tel.No.!'), "
													       + "ifnull(ml.telno2,'N/A'), " + "ml.typeof "
													       + "FROM tbl_master_list_bengaluru ml " 
													       + "WHERE ml.slno=";
   
   public static final String SEARCH_HOTEL      = "SELECT replace(replace(descr,'&reg;',' '),'&',' '), "
                                                         + "replace(replace(rname,'&Eacute;',' '),'&',' '),"
                                                         + "typeof, "
                                                         + "lat, "
                                                         + "lng, "
                                                         + "truncate( ( 6371 * acos( cos( radians('##') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('##') ) + sin( radians('##') ) * sin( radians( lat ) ) ) ) ,2)AS distance "
                                                         + "FROM tbl_master_list HAVING distance < '##' "
                                                         + "ORDER BY distance ";
   /*
    * "SELECT replace(replace(descr,'&reg;',' '),'&',' '), replace(replace(rname,'&Eacute;',' '),'&',' '),typeof, lat, lng, truncate( ( 6371 * acos( cos( radians('"
    * +
    * searchKey_lat+"') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('"+searchKey_lng+"') ) + sin( radians('"
    * +
    * searchKey_lat+"') ) * sin( radians( lat ) ) ) ) ,2)AS distance FROM tbl_master_list HAVING distance < '"+searchKey_rad
    * +"' ORDER BY distance ";
    */

   public static final String NEW_HOTEL_DETAILS = "INSERT INTO ucontribute (lat," 
                                                   + " lng, " 
                                                   + "rname, " 
                                                   + "landmark, "
                                                   + "phoneno, " 
                                                   + "musthaves, " 
                                                   + "descrip, " 
                                                   + "urname, "
                                                   + "uremail, " 
                                                   + "typeof, " 
                                                   + "addr)" 
                                                   + "VALUES("
                                                   + "'1'," 
                                                   + "'2',"
                                                   + "'3'," 
                                                   + "'4'," 
                                                   + "'5'," 
                                                   + "'6'," 
                                                   + "'7'," 
                                                   + "'8'," 
                                                   + "'9',"
                                                   + "'10'," 
                                                   + "'11')";
}
